package com.jzg.sys.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jzg.sys.common.rest.BaseRest;
import com.jzg.sys.dao.entity.SecSys;
import com.jzg.sys.manager.SecSysManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: Sys专属业务公用接口, 登录即可访问
 * @author:asxx 李志鹏
 * @create:2019-03-05 10:38
 */
@RestController
@RequestMapping("/sysRest")
@Api(value = "sysRest", description = "sys公用接口")
public class SysRest extends BaseRest {
    @Autowired
    private SecSysManager sysManager;

    /**
     * @param
     * @return
     * @Title: getSysList
     * @Description: 获取所属系统下拉
     * @Author: lzp 李志鵬
     * @Date: 2019/3/5
     */
    @ApiOperation(value = "获取所属系统下拉")
    @RequestMapping(value = "/getSysList", method = RequestMethod.GET)
    @ResponseBody
    public List<SecSys> getSysList() {
        return sysManager.list(new QueryWrapper<SecSys>().lambda()
                .eq(SecSys::getIsValid, true)
                .orderByAsc(SecSys::getSortNo)
        );
    }
}
